//
//  CirclrMineViewController.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/3.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "CirclrMineViewController.h"
#import "CircleMineViewModel.h"
#import "ReturnCardViewController.h"
#import "ReplyMineViewController.h"
#import "PostsListViewController.h"
#import "ILikedViewController.h"
#import "ILikedListViewController.h"
#import "CircleMineInforViewController.h"

@interface CirclrMineViewController ()
@property (nonatomic, strong) CircleMineViewModel *viewModel;

@end

@implementation CirclrMineViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"我的圈子";
    self.viewModel = [[CircleMineViewModel alloc] initWithViewToViewModel:self.groupedTableView theSuperView:self.view];
    WS(weakSelf);
    self.viewModel.BlockMineSelect = ^(NSIndexPath * _Nullable index) {
        [weakSelf pageVCWith:index];
    };
}

- (void)pageVCWith:(NSIndexPath *)indexP
{
    switch (indexP.section) {
        case 0:
            [self pageWith:[CircleMineInforViewController class]];
           
            break;
            
        case 1:
//            [self pageWith:[ILikedViewController class]];
            if (indexP.row == 0) {
                 [self postVc];
            }
            if (indexP.row == 1) {
                [self pageWith:[ILikedViewController class]];
            }
            if (indexP.row == 2) {
                [self myCircleWith:CircleType_ReturnCard];
            }
            break;
            
        case 2:
            if (indexP.row == 0) {
                [self pageWith:[ReplyMineViewController class]];
            }
            if (indexP.row == 1) {
                [self myCircleWith:CircleType_Comments];
                
            }
            
            break;
        default:
            break;
    }
}

- (void)postVc
{
    PostsListViewController *vc = [[PostsListViewController alloc] init];
    vc.postType = PostType_Other;
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)myCircleWith:(CircleType)type
{
    ReturnCardViewController *vc = [[ReturnCardViewController alloc] init];
    vc.circleType = type;
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)pageWith:(Class)cla
{
    UIViewController * vc = [[cla alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}

@end
